"use strict";
const electron = require("electron");
const showSystemDialog = (dialogTitle, dialogMessage) => {
  return electron.ipcRenderer.invoke("show-dialog", dialogTitle, dialogMessage);
};
const dialogipcRenderer = {
  showSystemDialog
};
const electronApi = {
  ...dialogipcRenderer
};
window.addEventListener("DOMContentLoaded", () => {
  const versions = process.versions;
  console.log("Electron versions:", versions);
});
electron.contextBridge.exposeInMainWorld("electronUpdater", {
  // 检查更新
  checkForUpdates: () => electron.ipcRenderer.send("check-for-updates"),
  // 立即安装更新
  installUpdateNow: () => electron.ipcRenderer.send("install-update-now"),
  // 监听更新可用事件
  onUpdateAvailable: (callback) => electron.ipcRenderer.on("update-available", (event, info) => callback(info)),
  // 监听下载进度事件
  onDownloadProgress: (callback) => electron.ipcRenderer.on("download-progress", (event, progress) => callback(progress)),
  // 监听更新下载完成事件
  onUpdateDownloaded: (callback) => electron.ipcRenderer.on("update-downloaded", (event, info) => callback(info)),
  // 监听更新错误事件
  onUpdateError: (callback) => electron.ipcRenderer.on("update-error", (event, error) => callback(error))
});
electron.contextBridge.exposeInMainWorld("electronApi", electronApi);
